#pragma once
#include "Mesh.h"
#include <posgraph/gl/gl.h>

class FnMeshRenderer
{
public:
	FnMeshRenderer(Mesh& _mesh);
	~FnMeshRenderer(void);

	const Mesh& mesh() const        { return  mesh_; }
	Mesh& mesh()                    { return  mesh_; }

public:
	void draw_mesh();
	void draw_names(const std::string &_primitive);
	void draw_vertex_names();
	void get_cube_face_property() { mesh_.get_property_handle(fprop_cube_face_, "fprop_cube_face"); mesh_.get_property_handle(vprop_cube_face_, "vprop_cube_face");}
	void get_cube_edge_property() { mesh_.get_property_handle(eprop_cube_edge_flag_, "eprop_cube_edge_flag"); }
	void get_edge_type_property() { mesh_.get_property_handle(eprop_type_, "eprop_type"); }
	void set_draw_type (const DrawType etype) { draw_type_ = etype; }
	void calc_normals();
	void setNSides(int n){ nSides = n;}

private:
	 Mesh&       mesh_;
	 int nSides;
	 OpenMesh::FPropHandleT<int> fprop_cube_face_;
	 OpenMesh::VPropHandleT<int> vprop_cube_face_;
	 OpenMesh::EPropHandleT<bool> eprop_cube_edge_flag_;
	 OpenMesh::EPropHandleT<EdgeType> eprop_type_;
	 DrawType draw_type_;
};
